<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class T_WMS_PO_INFO extends Model
{
    public $table='T_WMS_PO_INFO';
    public $connection='mysql';
    public function produce($day,$order='asc'){
        $where2[]=['CREATE_TIME','>=',date('Y-m-d',strtotime('-'."$day".'day'))];
        $where2[]=['CREATE_TIME','<>',''];
        $where2[]=['UPDATE_TIME','<>',''];
        $list=$this->where($where2)->field('DATEDIFF(day,OPEN_TIME,UPDATE_TIME) as time')->order('time',"$order")->find()->toArray();
        return $list;
    }
}
